// service.js
const express = require('express')
const app = express()
const path = require('path')

app.on('ready', function () {
  console.log('进入页面了')
})

// 注意这里使用path.join(__dirname, 'dist')而不是'dist'
// 虽然在命令行中执行起来效果是一样的，不过pkg打包会无法识别到dist目录
app.use(express.static(path.join(__dirname, 'dist')))

var server = app.listen(8080, function () {
  var host = server.address().address
  var port = server.address().port
  console.log(`AIbuy agents server start successfully on http://${host}:${port}`)
  console.log('打包出来了')
})
